package com.gpscookie.test.android;

import android.app.Activity;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import android.view.Window;
import android.view.WindowManager;
import android.view.animation.AnimationUtils;
import android.widget.ViewFlipper;

public class SplashScreen extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);  
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,   
        					 WindowManager.LayoutParams.FLAG_FULLSCREEN);           
        setContentView(R.layout.splash);       
        ViewFlipper flipper = ((ViewFlipper) this.findViewById(R.id.flipper));
        flipper.startFlipping();   
        flipper.setInAnimation(AnimationUtils.loadAnimation(this,
                android.R.anim.fade_in));
        flipper.setOutAnimation(AnimationUtils.loadAnimation(this,
                android.R.anim.fade_out)); 
        new DownloadTask().execute(null);
    }
    
    private class DownloadTask extends AsyncTask<String, Void, Object> {
        protected Boolean doInBackground(String... args) {
            Log.i("......", "Background thread starting");
            return true;
        }

        protected void onPostExecute(Object result) {
        	// start main windows here
        	Intent i = new Intent(SplashScreen.this, MainScreen.class);
        	SplashScreen.this.startActivity(i);
        	SplashScreen.this.finish();
        }
   }        
}
